<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="base" uri="http://qdbp.gitee.io/tags/base/"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<script type="text-metadata">
	<div class="combo-form">
		<div class="border">
			<form class="pure-box form-horizontal">
				<div class="form-group compact">
					<div class="col-md-1 control-label plr-clear">最大长度</div>
					<div class="col-md-1 control-input"><input class="x-numberbox" type="text" name="maxLength" data-options="precision:0,validType:['length[0,8]']"/></div>
					<div class="col-md-1 control-label plr-clear">正则</div>
					<div class="col-md-4 control-input"><input class="x-textbox" type="text" name="regexp" data-options="validType:['length[0,200]'],prompt:'~开头反转结果, 匹配就报错'"/></div>
					<div class="col-md-1 control-label plr-clear">错误提示</div>
					<div class="col-md-4 control-input"><input class="x-textbox" type="text" name="message" data-options="validType:['length[0,200]'],prompt:'正则校验失败的错误提示'"/></div>
				</div>
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-check'">确定</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>

<script type="number-metadata">
	<div class="combo-form">
		<div class="border">
			<form class="pure-box form-horizontal">
				<div class="form-group compact">
					<div class="col-md-1 control-label pl-clear">小数位数</div>
					<div class="col-md-1 control-input"><input class="x-numberbox" type="text" name="decimal" data-options="min:0,max:8,precision:0"/></div>
					<div class="col-md-2 control-label pl-clear">最小值</div>
					<div class="col-md-2 control-input"><input class="x-numberbox" type="text" name="minValue" data-options="precision:0"/></div>
					<div class="col-md-1 control-label pl-clear">最大值</div>
					<div class="col-md-2 control-input"><input class="x-numberbox" type="text" name="maxValue" data-options="precision:0"/></div>
				</div>
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-check'">确定</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>

<script type="enums-item"><%-- 必须有combo-item样式 --%>
	<div class="combo-item" data-key="<#=this.key#>">
		<div class="border"> <span class="text"><#=this.key#> : <#=this.value#></span>&nbsp;&nbsp;<a class="do-remove"><i class="fa fa-times"></i></a> </div>
	</div>
</script>
<script type="enums-metadata"><%-- 必须有combo-items节点 --%>
	<div class="combo-items">
		<div class="combo-operate">
			<a class="border do-create" title="新建"> <span class="fa fa-plus"></span> </a>
		</div>
		<div class="combo-operate">
			<a class="border do-clear" title="清除"> <span class="fa fa-trash-o"></span> </a>
		</div>
	</div>
	<div class="combo-form hide">
		<div class="border">
			<form class="pure-box form-horizontal">
				<div class="form-group compact">
					<div class="col-md-12 control-input">
						<input class="x-textbox" type="text" name="text" 
							data-options="required:true,multiline:true,height:50,validType:['enumsTextValidate']" 
							placeholder="格式1--&gt; MALE:男 | FEMALE:女&#13;&#10;格式2--&gt; 男|女 (KEY=从0开始的数字序号)"/>
					</div>
				</div>
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-reset" data-options="iconCls:'fa fa-retweet'">重置</a>
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-save'">保存</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>

<script type="object-item"><%-- 必须有combo-item样式 --%>
	<div class="combo-item" data-key="<#=this.fieldName#>">
		<div class="border"> <span class="text"><#=this.fieldName#>(<#=this.fieldText#>)</span>&nbsp;&nbsp;<a class="do-remove"><i class="fa fa-times"></i></a>&nbsp;&nbsp;<a class="do-edit"><i class="fa fa-pencil"></i></a> </div>
	</div>
</script>
<script type="object-metadata"><%-- 必须有combo-items节点 --%>
	<div class="combo-items">
		<div class="combo-operate">
			<a class="border do-create" title="新建"> <span class="fa fa-plus"></span> </a>
		</div>
		<div class="combo-operate">
			<a class="border do-clear" title="清除"> <span class="fa fa-trash-o"></span> </a>
		</div>
	</div>
	<div class="combo-form hide">
		<div class="border">
			<form class="pure-box form-horizontal">
				<div class="form-group compact">
					<div class="col-md-1 control-label pl-clear"><i class="asterisk"></i>字段文本</div>
					<div class="col-md-5 control-input"><input class="x-textbox" type="text" name="fieldText" data-options="required:true,validType:['conflictValidate'],prompt:'中文字段文本'"/></div>
					<div class="col-md-1 control-label pl-clear"><i class="asterisk"></i>字段名称</div>
					<div class="col-md-5 control-input"><input class="x-textbox" type="text" name="fieldName" data-options="required:true,validType:['fieldNameValidate','conflictValidate'],prompt:'英文字段名称'"/></div>
				</div>
				<div class="form-group compact">
					<div class="col-md-1 control-label pl-clear"><i class="asterisk"></i>值类型</div>
					<div class="col-md-5 control-input">
						<input class="x-combobox" type="text" name="valueType" data-options="
							required:true,editable:false,valueField:'type',textField:'name',onChange:onValueTypeChange"/>
					</div>
					<# if (this.options.useFieldType) { #>
					<div class="col-md-1 control-label pl-clear"><i class="asterisk"></i>字段类型</div>
					<div class="col-md-5 control-input">
						<input class="x-combobox" type="text" name="fieldType" data-options="
							required:true,editable:false,valueField:'type',textField:'text',
							data:[{type:'valueField',text:'编号字段 (必填, 唯一)'},{type:'textField',text:'名称字段 (必填, 唯一)'},{type:'requiredField',text:'普通字段 (必填)'},{type:'normalField',text:'普通字段 (非必填)'}]"/>
					</div>
					<# } else { #>
					<div class="col-md-1 control-label pl-clear">必填</div>
					<div class="col-md-5 control-input">
						<label class="input-group">
							<span class="input-group-addon"><input type="checkbox" name="required" value="1" data-def-value="1" checked /></span>
							<div class="form-control">是否必填</div>
						</label>
					</div>
					<# } #>
				</div>
				<#=this.valueTypeEditors#>
				<div class="form-group compact">
					<div class="col-md-1 control-label pl-clear">提示信息</div>
					<div class="col-md-11 control-input"><input class="x-textbox" type="text" name="prompt" data-options="required:false,prompt:'文本框内的提示文本(placeholder)'"/></div>
				</div>
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-check'">确定</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>
<script type="object-field">
	<# var className = this.valueType == "enums" ? "x-combobox" : this.valueType == "number" ? "x-numberbox" : "x-textbox"; #>
	<div class="form-group compact">
	<# if (this.valueType == "enums") { #>
		<div class="col-md-3 control-label plr-clear"><# if (this.required) { #><i class="asterisk"></i><# } #><#=this.fieldText#></div>
		<div class="col-md-8 control-input"><input class="x-combobox" type="text" name="<#=this.fieldName#>" data-options="required:<#=this.required||false#>,editable:false,value:'<#:h=this.fieldValue#>',valueField:'key',textField:'value'<#if(this.prompt){#>,prompt:'<#:h=this.prompt#>'<#}#>,data:<#:h=JSON.stringify(this.valueMetadata.items||[])#>,validType:['conflictValidate']"/></div>
	<# } else if (this.valueType == "number") { #>
		<div class="col-md-3 control-label plr-clear"><# if (this.required) { #><i class="asterisk"></i><# } #><#=this.fieldText#></div>
		<div class="col-md-8 control-input"><input class="x-numberbox" type="text" name="<#=this.fieldName#>" data-options="required:<#=this.required||false#>,value:'<#:h=this.fieldValue#>',precision:<#=this.valueMetadata&&this.valueMetadata.decimal||0#><#if(this.prompt){#>,prompt:'<#:h=this.prompt#>'<#}#>,metaRule:<#:h=JSON.stringify(this.valueMetadata||{})#>,validType:['numberValueValidate','conflictValidate']"/></div>
	<# } else { #>
		<div class="col-md-3 control-label plr-clear"><# if (this.required) { #><i class="asterisk"></i><# } #><#=this.fieldText#></div>
		<div class="col-md-8 control-input"><input class="x-textbox" type="text" name="<#=this.fieldName#>" data-options="required:<#=this.required||false#>,value:'<#:h=this.fieldValue#>'<#if(this.prompt){#>,prompt:'<#:h=this.prompt#>'<#}#>,metaRule:<#:h=JSON.stringify(this.valueMetadata||{})#>,validType:['textValueValidate','conflictValidate']"/></div>
	<# } #>
	</div>
</script>
<script type="object-config-value">
	<div class="combo-form">
		<div class="border">
			<form class="pure-box form-horizontal">
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-check'">确定</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>

<script type="objects-item"><%-- 必须有combo-item样式 --%>
	<div class="combo-item" data-key="<#=this[this.$metaConfig.valueField]#>">
		<div class="border">
			<span class="text">
				<# if (this.$metaConfig.textField) { #><#=this[this.$metaConfig.valueField]#>&nbsp;:&nbsp;<#=this[this.$metaConfig.textField]#>&nbsp;
				<# } else { #><#=this[this.$metaConfig.valueField]#>&nbsp;<# } #>
			</span>
			<a class="do-remove"><i class="fa fa-times"></i></a>&nbsp;&nbsp;<a class="do-edit"><i class="fa fa-pencil"></i></a>
		</div>
	</div>
</script>
<script type="objects-collect"><%-- 必须有combo-items节点 --%>
	<div class="combo-items">
		<div class="combo-operate">
			<a class="border do-create" title="新建"> <span class="fa fa-plus"></span> </a>
		</div>
		<div class="combo-operate">
			<a class="border do-clear" title="清除"> <span class="fa fa-trash-o"></span> </a>
		</div>
	</div>
	<div class="combo-form hide">
		<div class="border">
			<form class="pure-box form-horizontal">
			</form>
			<div class="dialog-button">
				<a class="x-linkbutton do-save" data-options="iconCls:'fa fa-check'">确定</a>
				<a class="x-linkbutton do-cancel" data-options="iconCls:'fa fa-close'">取消</a>
			</div>
		</div>
	</div>
</script>
